package com.wty.gw.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wty.gw.util.PageParamReq;
import com.wty.gw.dao.ProductCatalogMapper;
import com.wty.gw.model.Do.ProductCatalogDO;
import com.wty.gw.model.query.ProductCatalogQuery;
import com.wty.gw.service.ProductCatalogService;
import com.wty.gw.model.vo.ProductCatalogVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ProductCatalogServiceImpl implements ProductCatalogService{

	@Autowired
    private ProductCatalogMapper productCatalogMapper;

    @Override
    public void add(ProductCatalogDO productCatalogDo) {
        productCatalogMapper.insert(productCatalogDo);
    }

    @Override
    public void delete(Long id) {
        productCatalogMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(ProductCatalogDO productCatalogDo) {
        productCatalogMapper.updateByPrimaryKeySelective(productCatalogDo);
    }

    @Override
    public PageInfo<ProductCatalogVo> listByPage(ProductCatalogQuery productCatalogQuery) {
        PageHelper.startPage(productCatalogQuery.getPageNo(), productCatalogQuery.getPageSize());

        return new PageInfo(productCatalogMapper.listBycompanyId(productCatalogQuery));
    }

    @Override
    public ProductCatalogDO get(Long id) {
        return productCatalogMapper.selectByPrimaryKey(id);
    }
	
	
	
	
	
	
}